// SquareLine LVGL GENERATED FILE
// EDITOR VERSION: SquareLine Studio 1.0.5
// LVGL VERSION: 8.2
// PROJECT: SquareLine_Project

#include "ui.h"
#include "ui_helpers.h"

///////////////////// VARIABLES ////////////////////
lv_obj_t * ui_Screen1;
lv_obj_t * ui_Arc1;
lv_obj_t * ui_Button1;
lv_obj_t * ui_Label1;
lv_obj_t * ui_Switch1;
lv_obj_t * ui_Bar1;
lv_obj_t * ui_Spinner1;
lv_obj_t * ui_Dropdown1;

///////////////////// TEST LVGL SETTINGS ////////////////////
#if LV_COLOR_DEPTH != 16
    #error "LV_COLOR_DEPTH should be 16bit to match SquareLine Studio's settings"
#endif
#if LV_COLOR_16_SWAP !=1
    #error "#error LV_COLOR_16_SWAP should be 1 to match SquareLine Studio's settings"
#endif

///////////////////// ANIMATIONS ////////////////////

///////////////////// FUNCTIONS ////////////////////

///////////////////// SCREENS ////////////////////
void ui_Screen1_screen_init(void)
{

    // ui_Screen1

    ui_Screen1 = lv_obj_create(NULL);

    lv_obj_clear_flag(ui_Screen1, LV_OBJ_FLAG_SCROLLABLE);

    // ui_Arc1

    ui_Arc1 = lv_arc_create(ui_Screen1);

    lv_obj_set_width(ui_Arc1, 106);
    lv_obj_set_height(ui_Arc1, 105);

    lv_obj_set_x(ui_Arc1, -91);
    lv_obj_set_y(ui_Arc1, 43);

    lv_obj_set_align(ui_Arc1, LV_ALIGN_CENTER);

    lv_arc_set_range(ui_Arc1, 0, 100);
    lv_arc_set_bg_angles(ui_Arc1, 120, 60);

    // ui_Button1

    ui_Button1 = lv_btn_create(ui_Screen1);

    lv_obj_set_width(ui_Button1, 100);
    lv_obj_set_height(ui_Button1, 50);

    lv_obj_set_x(ui_Button1, -84);
    lv_obj_set_y(ui_Button1, -58);

    lv_obj_set_align(ui_Button1, LV_ALIGN_CENTER);

    lv_obj_add_flag(ui_Button1, LV_OBJ_FLAG_SCROLL_ON_FOCUS);
    lv_obj_clear_flag(ui_Button1, LV_OBJ_FLAG_SCROLLABLE);

    // ui_Label1

    ui_Label1 = lv_label_create(ui_Screen1);

    lv_obj_set_width(ui_Label1, LV_SIZE_CONTENT);
    lv_obj_set_height(ui_Label1, LV_SIZE_CONTENT);

    lv_obj_set_x(ui_Label1, -84);
    lv_obj_set_y(ui_Label1, -57);

    lv_obj_set_align(ui_Label1, LV_ALIGN_CENTER);

    lv_label_set_text(ui_Label1, "Text");

    // ui_Switch1

    ui_Switch1 = lv_switch_create(ui_Screen1);

    lv_obj_set_width(ui_Switch1, 50);
    lv_obj_set_height(ui_Switch1, 25);

    lv_obj_set_x(ui_Switch1, -10);
    lv_obj_set_y(ui_Switch1, 16);

    lv_obj_set_align(ui_Switch1, LV_ALIGN_CENTER);

    // ui_Bar1

    ui_Bar1 = lv_bar_create(ui_Screen1);
    lv_bar_set_range(ui_Bar1, 0, 100);
    lv_bar_set_value(ui_Bar1, 25, LV_ANIM_OFF);

    lv_obj_set_width(ui_Bar1, 150);
    lv_obj_set_height(ui_Bar1, 10);

    lv_obj_set_x(ui_Bar1, 48);
    lv_obj_set_y(ui_Bar1, 96);

    lv_obj_set_align(ui_Bar1, LV_ALIGN_CENTER);

    // ui_Spinner1

    ui_Spinner1 = lv_spinner_create(ui_Screen1, 1000, 90);

    lv_obj_set_width(ui_Spinner1, 80);
    lv_obj_set_height(ui_Spinner1, 80);

    lv_obj_set_x(ui_Spinner1, 90);
    lv_obj_set_y(ui_Spinner1, 25);

    lv_obj_set_align(ui_Spinner1, LV_ALIGN_CENTER);

    lv_obj_clear_flag(ui_Spinner1, LV_OBJ_FLAG_CLICKABLE);

    // ui_Dropdown1

    ui_Dropdown1 = lv_dropdown_create(ui_Screen1);
    lv_dropdown_set_options(ui_Dropdown1, "Option 1\nOption 2\nOption 3");
    lv_dropdown_set_text(ui_Dropdown1, "");

    lv_obj_set_width(ui_Dropdown1, 150);
    lv_obj_set_height(ui_Dropdown1, LV_SIZE_CONTENT);

    lv_obj_set_x(ui_Dropdown1, 54);
    lv_obj_set_y(ui_Dropdown1, -66);

    lv_obj_set_align(ui_Dropdown1, LV_ALIGN_CENTER);

    lv_obj_add_flag(ui_Dropdown1, LV_OBJ_FLAG_SCROLL_ON_FOCUS);

}

void ui_init(void)
{
    lv_disp_t * dispp = lv_disp_get_default();
    lv_theme_t * theme = lv_theme_default_init(dispp, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_RED),
                                               false, LV_FONT_DEFAULT);
    lv_disp_set_theme(dispp, theme);
    ui_Screen1_screen_init();
    lv_disp_load_scr(ui_Screen1);
}

